<template>
	<view class="newCar-page" :style="'background-color:' + pageBackgroundColor + ';'">
		<cu-custom bgColor="bg-blue" :isBack="true">
			<block slot="backText"></block>
			<block slot="content">
				<text class="nav-title">新能源车</text>
			</block>
		</cu-custom>
		<addressSearchFixed ref="setAddres" @searchBtn='event_clickSearchBtn' :isShowAddress="false">
		</addressSearchFixed>

		<view style="padding-top: 80rpx;background: #fff;">
			<view style="display: flex;flex-wrap: nowrap;justify-content:space-between;padding: 30rpx;">
				 <!-- <view class="li" :class="{se:status == '1'}">-->
				<view class="li" style="">
					<view style="display: flex;" @click="Che()">
						<view class="li-txt">全部车型</view>
						<view class="li-img">
							<image src="../../../../static/wertc2.png" mode=""></image>
						</view>
					</view>
					<view class="li-ab" v-if="CState">
						<view class="li-ab-l" v-for="item in typeList" :key="">
							<view class="li-ab-l-left">2020款 魅580</view>
							<view class="li-ab-l-rig">633条</view>
						</view>
						
					</view>
				</view>
				<view class="li">
					<view style="display: flex;" @click="pear()">
						<view class="li-txt">外观/内饰</view>
						<view class="li-img">
							<image src="../../../../static/wertc2.png" mode=""></image>
						</view>
					</view>
					<view class="li-ab" v-if="WGState">
						<view class="li-ab-l">
							<view class="li-ab-l-left">2020款 魅580</view>
							<view class="li-ab-l-rig">633条</view>
						</view>
						<view class="li-ab-l">
							<view class="li-ab-l-left">2020款 魅580</view>
							<view class="li-ab-l-rig">633条</view>
						</view>
						<view class="li-ab-l">
							<view class="li-ab-l-left">2020款 魅580</view>
							<view class="li-ab-l-rig">633条</view>
						</view>
					</view>
				</view>
				<view class="li">
					<view style="display: flex;" @click="City()">
						<view class="li-txt">全部地区</view>
						<view class="li-img">
							<image src="../../../../static/wertc2.png" mode=""></image>
						</view>
					</view>
					<view class="li-ab" v-if="CityState">
						<view class="li-ab-l">
							<view class="li-ab-l-left">全部地区</view>
							<view class="li-ab-l-rig">633条</view>
						</view>
						<view class="li-ab-l">
							<view class="li-ab-l-left">天津</view>
							<view class="li-ab-l-rig">633条</view>
						</view>
						<view class="li-ab-l">
							<view class="li-ab-l-left">上海</view>
							<view class="li-ab-l-rig">633条</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view style="padding: 30rpx;">
			<view class="eng-l">
				<view class="eng-l-H">奥迪A6L新能源 22款 55 e quattro</view>
				<view class="eng-l-head">国产现车 墨玉黑丨赤金</view>
				<view class="eng-l-tt">
					<view class="eng-l-tt-l">手续随车丨销全国丨车在</view>
				</view>
				<view class="eng-l-bottom">
					<view class="eng-l-bottom-left">
						<view class="eng-l-bottom-left-o">售价:33.80万</view>
						<view class="eng-l-bottom-left-z">指导价:128.80万</view>
					</view>
					<view class="eng-l-bottom-rig">22:15</view>
				</view>
			</view>
		</view>
	</view>
	
</template>

<script>
	import cuCustom from "@/components/custom-nav/cu-custom.vue";
	import addressSearchFixed from "@/components/addressSearch/addressSearchFixed.vue";
	
	import {
		getCardList,
		getCardModel
	} from '@/api/card.js'
	export default {
		components: {
			cuCustom,
			addressSearchFixed,
		},
		data() {
			return {
				CState:false,	//车
				CityState:false,	//地区
				WGState:false,	//外观
				status:'1',
				customNavTitleIndex: 1, // 页面标题下标
				pageBackgroundColor: '#F7F8FA', // 页面背景颜色
				sreachContent: '', //寻车列表中搜索框的功能
				reqParams:{
					// 二级车系id 
					series_two_id:'',
					// 外观颜色id
					appearance_id:'',
					// 内饰颜色id
					interior_id:"",
					// 省或市id
					city_id:''
				},
				arrList:[],
				typeList:[]
			}
		},
		onShow() {
			try {
				this.$refs.setAddres.setAddres()
			} catch (e) {
				
			}

		},
		onHide() {
			this.$utils.movePage()
		},
		onUnload() {
			this.$utils.movePage()
		},
		onLoad(opt) {
			if(opt.id){
				this.reqParams.series_two_id=opt.id
				this.getCardList()
				this.getCardModel()
			}
		},
		methods: {
			async getCardModel(){
				const res= await getCardModel(this.reqParams.series_two_id)
				if(res.code==0){
					this.typeList=res.data.value
				console.log(res.data.value);
				}
			},
			async getCardList(){
				const res= await getCardList(this.reqParams)
				if(res.code==0){
				// console.log(res.data);
					this.arrList=res.data
				}
			},
			// 外观
			pear(){
				this.WGState = !this.WGState
			},
			// 地区
			City(){
				this.CityState = !this.CityState
			},
			// 车型
			Che(){
				this.CState = !this.CState
			},
			// 点击——新车
			event_clickNewCarTitle() {
				this.$utils.log("新车")
				this.currentTitle = '新车'
			},
			// 点击——寻车
			event_clickSeachCarTitle() {
				this.$utils.log("寻车")
				this.currentTitle = '寻车'
			},
			// 点击——搜索框搜索按钮
			event_clickSearchBtn(content) {
				this.sreachContent = content
				this.$utils.log("点击搜索" + content)
				if (this.customNavTitleIndex == 2) {
					const loaction = uni.getStorageSync('address')
				} else {
					const loaction = uni.getStorageSync('address')
				}
			},


		}
	}
</script>

<style>
	page{
		background: #F7F8FA;
	}
	.li-ab-l-left{
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #000000;	
	}
	.li-ab-l-rig{
		font-size: 24rpx;
		font-family: PingFangSCRegular;
		font-weight: 400;
		color: #999999;
	}
	.li-ab-l{
		padding: 30rpx;
		display: flex;
		flex-wrap: nowrap;
		justify-content:space-between;
	}
	.li-ab{
		position: absolute;
		top: 260rpx;
		left: 0rpx;
		width: 100%;
		background: #FFFFFF;
		box-shadow: 0px 18px 20px -18px #888889;
	}
	.eng-l-bottom-rig{
		font-size: 20rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
		padding-top: 5rpx;
	}
	.eng-l-bottom-left-z{
		font-size: 20rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
		padding-top: 10rpx;
	}
	.eng-l-bottom-left-o{
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: 800;
		color: #EC4B4B;
		margin-right: 20rpx;
	}
	.eng-l-bottom-left{
		display: flex;
	}
	.eng-l-bottom{
		display: flex;
		flex-wrap: nowrap;
		justify-content:space-between;
		margin-top: 37rpx;
	}
	.eng-l-tt-l{
		
	}
	.eng-l-tt{
		display: flex;
		font-size: 20rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;padding-top: 18rpx;
	}
	.eng-l-head{
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
		padding-top: 18rpx;
	}
	.eng-l-H{
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 800;
		color: #000000;
	}
	.eng-l{
		padding: 30rpx 20rpx;
		background: #FFFFFF;
		border-radius: 14rpx;
		margin-bottom: 20rpx;
	}
	.se{
		
		height: 27rpx;
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		/* color: #2D56C5; */
		text-align: center;
	}
	.li{
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		
		display: flex;
		
	}
	.li-txt{
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		padding-top: 5rpx;
		padding-right: 10rpx;
	}
	.li-img{
		width: 16rpx;
		height: 10rpx;
	}
	.li-img image{
		width: 100%;
		height: 100%;
	}
	.newCar-page {
		display: flex;
		flex-direction: column;
		width: 100%;
		height: auto;
	}

	.newCar-page .newCar-page__content {
		height: 100vh;
		/* 父元素设置相对定位 */
		position: relative;
		/* background-color: #F7F8FA; */
		background-color: #F7F8FA;
		padding: 26rpx 28rpx 0 28rpx;
	}

	/* 车系列表 */
	.carSeries-list {
		display: flex;
	}

	.carSeries-list__left {
		flex: 1;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.carSeries-list__right {
		flex: 1;
		display: flex;
		justify-content: center;
		align-items: center;

		margin-left: 14rpx;
	}

	/* 车系卡片 */
	.carSeries-card {
		border-radius: 10px;
		background-color: #FFFFFF;
		width: 100%;
		flex: 1;
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.carSeries-card__text {
		display: flex;
		flex-direction: column;
		margin-left: 30rpx;
	}

	.carSeries-card__text .title {
		font-family: Source Han Sans CN;
		font-weight: bold;
		font-size: 14px;
		text-align: left;
	}

	.carSeries-card__text .desc {
		margin-top: 5px;
		text-align: left;
		font: Alimama ShuHeiTi;
		font-size: 12px;
		color: #666666;
	}

	.carSeries-card__image {
		width: 58rpx;
		height: 50rpx;
		margin: 39rpx 50rpx 39rpx auto;
	}

	/* 常用车品牌列表 */
	.carCommonBrand-list {
		text-align: left;
		background-color: #FFFFFF;
		/* margin: 0px 14px 0px 14px; */
		border-radius: 10px;
		padding: 28rpx;
	}

	.carCommonBrand-list__title-background {
		width: 75px;
		background: url(@/static/bac-small.png);
		background-size: 100% 100%;
	}

	.carCommonBrand-list__title {
		width: 140rpx;
		font-size: 30rpx;
		font-weight: bold;
		color: #000026;
		opacity: 1;
		margin-left: 2rpx;
	}

	.carCommonBrand-list__content {
		display: flex;
		justify-content: center;
		padding: 37rpx 0 9rpx 0;
	}

	/* 车品牌 */
	.carBrand {
		flex: 1;
		width: 140rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.carBrand__image {
		height: 56rpx;
		width: 56rpx;
	}

	.carBrand__name {
		margin-top: 28rpx;

		font-size: 28rpx;
		font-weight: bold;
	}

	/* 车品牌索引列表 */
	.newCar-indexed-list__title-wrapper {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		padding: 6px 0px 4px 14px;
	}

	.newCar-indexed-list__title {
		font-size: 28rpx;
		font-family: DIN Alternate;
		font-weight: bold;
		color: #1C2125;
		opacity: 1;
	}

	.newCar-indexed-list__menu {
		display: flex;
		position: fixed;

		top: 50%;
		right: 0;
		-webkit-transform: translate(-50%, -50%);
		transform: translate(0, -50%);

		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.nav-title {
		font-size: 36rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		line-height: 0rpx;
		color: #FFFFFF;
		opacity: 1;
		margin-left: 20rpx;
		margin-right: 20rpx;
	}

	.nav-title-selected {
		font-family: Alimama ShuHeiTi;
		font-weight: bold;
	}

	.content-row {
		display: flex;
		flex-direction: row;
		align-items: center;
	}


	.pad18-14 {
		padding: 18rpx 28rpx;
	}

	.pad6-14-4 {
		padding: 6px 0px 4px 14px;
	}

	.iamge-class {
		width: 100rpx;
		height: 52rpx;
	}

	.marginLeft5 {
		margin-left: 5px;
	}

	.brand-name-class {
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #000026;
		opacity: 1;
	}

	.right-view-text {
		font-size: 20rpx;
		font-family: DIN Alternate;
		font-weight: bold;
		color: #999999;
		padding: 4rpx;
	}

	.right-view-text-select {
		font-size: 20rpx;
		font-family: DIN Alternate;
		font-weight: bold;
		color: #0E59EA;
		padding: 4rpx;
	}
</style>